using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for CatChuoi
/// </summary>
/// 

    public class ToolCatChuoi
    {

        public static string GetShortReview(string str, int NumberOfWords)
        {
            string[] Words = str.Split(' ');
            string sReturn = string.Empty;
            string sTemp = string.Empty;
            if (Words.Length <= NumberOfWords)
            {
                sReturn = str;
            }
            else
            {
                for (int i = 0; i < NumberOfWords; i++)
                {
                    sTemp+= Words.GetValue(i).ToString() + " ";
                }
                sReturn = sTemp.ToString()+" ...";
            }
            return sReturn.ToString();
        }
        /// <summary>
        /// cat chuoi tooltip dung de loai bo ky tu "" cho hien thi tooltip chuan
        /// </summary>
        /// <param name="str">chuoi can truyen vao</param>
        /// <returns></returns>
        public static string catchuoitooltip(string str)
        {

            string[] Words = str.Split('"');

            string sTemp = string.Empty;
            string sReturn = string.Empty;

            for (int i = 0; i < Words.Length; i++)
            {
                sTemp += Words.GetValue(i).ToString();
            }
           return sReturn = sTemp.ToString();
        }
    }
